<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="/Public/css/bootstrap.min.css">
  <link rel="stylesheet" href="/Public/css/flat-ui.min.css">
  <link rel="stylesheet" href="/Public/css/wangEditor.min.css">
  <link rel="stylesheet" href="/Public/css/admin.css" charset="utf-8">
  <title>随遇而安blog</title>
</head>
<body>
  <div class="navbar navbar-default  header" role="navigation">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
          <span class="sr-only">Toggle navigation</span>
        </button>
        <a class="navbar-brand" href="<?php echo U('Home/Index/index');?>" target="_blank">随遇而安Blog</a>
      </div>
      <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
          <li><a href="">首页</a></li>
          <li><a href="<?php echo U('Article/index');?>">文章管理</a></li>
          <li><a href="<?php echo U('Article/category');?>">分类管理</a></li>
          <li><a href="<?php echo U('Works/index');?>">作品管理</a></li>
        </ul>
      </div><!--/.nav-collapse -->
    </div>
</div>

    <div class="container content">
      <?php if(I('get.id') == null): ?><form action="<?php echo U('Article/addArticle');?>" method="post">
      <?php else: ?>
        <form action="<?php echo U('Article/updateArticle');?>" method="post">
          <input type="hidden"  value="<?php echo I('get.id');?>" name="id" value=""><?php endif; ?>
        <div class="form-group">
              <label>文章标题</label>
              <input name="title" value="<?php echo ($article["title"]); ?>" type="text" class="form-control" >
        </div>
        <div class="form-group">
              <label>简介</label>
              <input name="about" value="<?php echo ($article["about"]); ?>" type="text" class="form-control"  >
        </div>
        <div class="form-group">
          <label >分类<a href="javascript:;"   data-toggle="modal" data-target=".bs-example-modal-lg">添加分类</a></label>
           <select name="cid" data-toggle="select" class="form-control select select-primary ">
               <?php if(is_array($cates)): foreach($cates as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
           </select>
         </div>
         <div class="form-group">
               <label>文章内容</label>
               <textarea name="content" id="textarea"><?php echo ($article["content"]); ?></textarea>
         </div>
         <?php if(I('get.id') == null): ?><button type="submit" class="btn btn-primary btn-lg btn-block"  >发布</button>
         <?php else: ?>
           <button type="submit" class="btn btn-primary btn-lg btn-block">提交修改</button><?php endif; ?>
      </form>
    </div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg">
    <form action="<?php echo U('Article/addCate');?>" method="post">
    <div class="modal-content">
      <h6>添加分类</h6>
      <div class="form-group">
            <label>级别</label>
            <input name="lv" type="number" class="form-control"  >
            <label>分类名称 </label>
            <input name="name" type="text" class="form-control" >
      </div>
        <button type="submit" class="btn btn-primary btn-lg btn-block">添加</button>
    </div>
    </form>
  </div>
</div>

<footer class="container-full">

</footer>
<script src="/Public/js/vendor/jquery.min.js" charset="utf-8"></script>
<script src="/Public/js/flat-ui.min.js" charset="utf-8"></script>
<script src="/Public/js/app.js" charset="utf-8"></script>


<script src="/Public/js/wangEditor.min.js" charset="utf-8"></script>
<script type="text/javascript">
var editor = new wangEditor('textarea');
 editor.create();
</script>
</body>
</html>